WorkflowDemployForm = Ext.extend(Ext.Window, {
    constructor : function(a) {
        Ext.applyIf(this, a);
        this.initUIComponents();
        WorkflowDemployForm.superclass.constructor.call(this, {
            layout : "fit",
            items : yearGridFormPanel,
            modal : true,
            bodyStyle : "padding:2px;",
            buttonAlign : "center",
            buttons : yearGridFormButtons,
            title : "上传部署文件",
            iconCls : "menu-flowWait",
            width :350,
            height : 200
        });
    },
    initUIComponents : function() {
        createyeargridform({
            operation : this,
            form : {
                saveUrl : __ctxPath + "/bpmndemo/newdeployWorkflow.do",      
                fileUpload: true, 
                items : [{
                    layout : "form", // 第一行
                    bodyStyle : "padding:10px;",
                    defaultType : "textfield",
                    items : [ {
                            fieldLabel : '部署名称' + '<font color=red>*</font>',
                            name : "bpmnFilName",
                            maxLength : 80,
                            width : 200,
                            allowBlank : false,
                            blankText :'部署名称不能为空'
                        }, {
                            fieldLabel : 'zip文件' + '<font color=red>*</font>',
                            name : "bpmnFile",
                            maxLength : 80,
                            xtype :'fileuploadfield',
                            width : 200,
                            allowBlank : false,
                            blankText:'附件不能为空',
                            buttonText:'选择文件',
                            listeners:{
                                fileselected:function(item){
                                    var path=item.value;
                                    var suffixName=path.substr(path.lastIndexOf("."));
                                    suffixName=suffixName.toLowerCase();
                                    if(suffixName!='.zip'){
                                        item.setValue('');
                                        Ext.Msg.alert('提示', '请选择流程、图片的ZIP压缩文件');
                                    }else{
                                        var start=path.lastIndexOf("\\")+1;
                                        var end=path.lastIndexOf(suffixName)
                                        yearGridFormPanel.getCmpByName("bpmnFilName").setValue(path.substring(start,end));
                                    }
                                }
                            }
                            
                        },{ 
                           
                            maxLength : 80,
                            xtype:"displayfield",
                            width : 200,
                            value : '<font color="red">请上传流程的bpmn文件和对应jpg文件的ZIP压缩包<font>'
                            
                        }]
                }]
            },
            loadData : {
                getUrl : __ctxPath + "/weixianzuoye/getWeiXianZuoYeGuanLi.do",
                preName : "weiXianZuoYeGuanLi"
            },
            isShow : this.isShow
        });
    }
});
